home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / NOTES < prev    next >
Text File  |  1992-02-16  |  3KB  |  76 lines

  1. Feature Test Macros
  2. --------------------
  3.  
  4.    The exact set of features available when you compile a source file
  5. is controlled by which "feature test macros" you define.
  6.  
  7.    If you compile your programs using `gcc -ansi', you get only the
  8. ANSI C library features, unless you explicitly request additional
  9. features by defining one or more of the feature macros.  *Note
  10. Options: (gcc.info)Options, for more information about GCC options.
  11.  
  12.    You should define these macros by using `#define' preprocessor
  13. directives at the top of your source code files.  You could also use
  14. the `-D' option to GCC, but it's better if you make the source files
  15. indicate their own meaning in a self-contained way.
  16.  
  17.  -- Macro: _POSIX_SOURCE
  18.      If you define this macro, then the functionality from the POSIX.1
  19.      standard (IEEE Standard 1003.1) is available, as well as all of
  20.      the ANSI C facilities.
  21.  
  22.  -- Macro: _POSIX_C_SOURCE
  23.      If you define this macro with a value of `1', then the
  24.      functionality from the POSIX.1 standard (IEEE Standard 1003.1) is
  25.      made available.  If you define this macro with a value of `2',
  26.      then both the functionality from the POSIX.1 standard and the
  27.      functionality from the POSIX.2 standard (IEEE Standard 1003.2)
  28.      are made available.  This is in addition to the ANSI C facilities.
  29.  
  30.  -- Macro: _BSD_SOURCE
  31.      If you define this macro, functionality derived from 4.3 BSD Unix
  32.      is included as well as the ANSI C, POSIX.1, and POSIX.2 material.
  33.  
  34.      Some of the features derived from 4.3 BSD Unix conflict with the
  35.      corresponding features specified by the POSIX.1 standard.  If this
  36.      macro is defined, the 4.3 BSD definitions take precedence over the
  37.      POSIX definitions.
  38.  
  39.  -- Macro: _SVID_SOURCE
  40.      If you define this macro, functionality derived from SVID is
  41.      included as well as the ANSI C, POSIX.1, and POSIX.2 material.
  42.  
  43.  -- Macro: _GNU_SOURCE
  44.      If you define this macro, everything is included: ANSI C, POSIX.1,
  45.      POSIX.2, BSD, SVID, and GNU extensions.  In the cases where
  46.      POSIX.1 conflicts with BSD, the POSIX definitions take precedence.
  47.  
  48.      If you want to get the full effect of `_GNU_SOURCE' but make the
  49.      BSD definitions take precedence over the POSIX definitions, use
  50.      this sequence of definitions:
  51.  
  52.           #define _GNU_SOURCE
  53.           #define _BSD_SOURCE
  54.           #define _SVID_SOURCE
  55.  
  56.    We recommend you use `_GNU_SOURCE' in new programs.  If you don't
  57. specify the `-ansi' option to GCC and don't define any of these macros
  58. explicitly, the effect as the same as defining `_GNU_SOURCE'.
  59.  
  60.    When you define a feature test macro to request a larger class of
  61. features, it is harmless to define in addition a feature test macro for
  62. a subset of those features.  For example, if you define
  63. `_POSIX_C_SOURCE', then defining `_POSIX_SOURCE' as well has no
  64. effect.  Likewise, if you define `_GNU_SOURCE', then defining either
  65. `_POSIX_SOURCE' or `_POSIX_C_SOURCE' or `_SVID_SOURCE' as well has no
  66. effect.
  67.  
  68.    Note, however, that the features of `_BSD_SOURCE' are not a subset
  69. of any of the other feature test macros supported.  This is because it
  70. defines BSD features that take precedence over the POSIX features that
  71. are requested by the other macros.  For this reason, defining
  72. `_BSD_SOURCE' in addition to the other feature test macros does have
  73. an effect: it causes the BSD features to take priority over the
  74. conflicting POSIX features.
  75.  
  76.